package com.rzhd.coursepatriarch.common.utils.permission;

import android.content.Context;
import android.text.TextUtils;

import com.rzhd.coursepatriarch.common.R;
import com.yanzhenjie.permission.Permission;
import com.yanzhenjie.permission.Rationale;
import com.yanzhenjie.permission.RequestExecutor;

import java.util.List;

/**
 * @author yql
 * @date: 2018/9/13.
 */
public class RuntimeRationale implements Rationale<List<String>> {

    @Override
    public void showRationale(Context context, List<String> permissions, final RequestExecutor executor) {
        List<String> permissionNames = Permission.transformText(context, permissions);
        String message = context.getString(R.string.message_permission_rationale, TextUtils.join("\n", permissionNames));
        executor.execute();
//        new AlertDialog.Builder(context)
//                .setCancelable(false)
//                .setTitle(R.string.title_dialog)
//                .setMessage(message)
//                .setPositiveButton(R.string.resume, new DialogInterface.OnClickListener() {
//                    @Override
//                    public void onClick(DialogInterface dialog, int which) {
//                        executor.execute();
//                    }
//                })
//                .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
//                    @Override
//                    public void onClick(DialogInterface dialog, int which) {
//                        executor.cancel();
//                    }
//                })
//                .show();
    }
}
